package fr.enseirbmatmeca.apms.tapestry.pages;

import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.ioc.annotations.Inject;

import fr.enseirbmatmeca.apms.spring.service.UserManager;

public class Login extends Security {

	private String login;
	private String password;

	public String getLogin() {
		return login;
	}

	public String getPassword() {
		return password;
	}

	String onSuccess() {
		//mon code metier, on test le login / pass
		boolean isValid = userManager.checkLogin(login, password);
		String ret = null;
		if(isValid){
			ret = "Index";
		}
		return ret;
	}

	@Validate("required")
	public void setLogin(String login) {
		this.login = login;
	}

	@Validate("required")
	public void setPassword(String password) {
		this.password = password;
	}
}